package com.hbxy.favorite.controller;


import com.hbxy.favorite.resault.ResponseBo;
import com.hbxy.favorite.service.CollectTypeService;
import com.hbxy.favorite.vo.CollectVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class CollectTypeController {
    private Logger log = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private  CollectTypeService collectTypeService;

    @RequestMapping("/getCollectType")
    @ResponseBody
    public ResponseBo getCollectType() {

        ResponseBo responseBo = collectTypeService.getCollectType();

        return responseBo;
    }

    /**
     * 未登录前的收藏页面
     * @return
     */
    @RequestMapping("/getCollectSearch")
    public String getCollectByid(String title, Model model) {

        List<CollectVo> collectVoList;
        collectVoList   = collectTypeService.getCollectByid(title);
        model.addAttribute("collectList",collectVoList);

        return "page-collect";
    }


}
